import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

import Home from '../components/home/home.vue';
import Center from '../components/center/center.vue';
import Cart from '../components/cart/cart.vue';
import Member from '../components/member/member.vue';
import NewList from '../components/home/newList.vue';
import Detail from '../components/home/detail.vue';
import Scroll from '../components/home/scroll.vue';

export const router = new VueRouter({
    routes: [
        { path: '/', redirect: '/home' },
        { 
            path: '/home', 
            component: Home,
            // 路由的嵌套 只显示在home组件下 routerview
            // children: [
            //     { path: 'newList', component: NewList }
            // ]
            name: 'home'
        },
        { path: '/member', component: Member },
        { path: '/cart', component: Cart },
        { path: '/center', component: Center },
        { path: '/home/newList/:id', component: NewList },
        { path: '/home/newList/detail/:id', component: Detail },
        { path: '/home/scroll', component: Scroll },
    ],
    linkActiveClass: 'mui-active'
})